/**
 * @author Tin Huynh
 *
 */
package uit.tkorg.coauthorgraph.bo;

import uit.tkorg.coauthorgraph.dbaccess.PaperMapper;
import uit.tkorg.coauthorgraph.dto.PaperDTO;

public class PaperBO {
	
    /**
     * check if the specified paper exist in the DB
     * @param paperDTO
     * @return
     * @throws Exception
     */
    public boolean isPaperExisted(PaperDTO paperDTO) throws Exception {
        PaperMapper mapper = null;
        try {
            mapper = new PaperMapper();
            return mapper.isPaperExisted(paperDTO);
        }
        catch (Exception e) {
            throw e;
        }
        finally {
            mapper.closeConnection();
        }
    }

    /**
     * insert a new paper into the DB
     * @param paperDTO
     * @return
     * @throws Exception
     */
    public int insertNewPaper(PaperDTO paperDTO) throws Exception {
        PaperMapper mapper = null;
        try {
            mapper = new PaperMapper();
            return mapper.insertNewPaper(paperDTO);
        }
        catch (Exception e) {
            throw e;
        }
        finally {
            mapper.closeConnection();
        }
    }
	
	
}
